<!doctype html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<link rel="stylesheet" href="../res/css/weui.css"/>
<link rel="stylesheet" href="../res/css/weuix.css"/>
<link rel="stylesheet" href="../res/css/common.css" />
<script src="../res/js/zepto.min.js"></script>
<script src="../res/js/zepto.weui.js"></script>
<script src="../res/js/common.js?v=1"></script>
<script>
    var doctor_id = getQst("doctor_id");
    function showDoctor() {
        var paramJson = { "hospital_id": 1, "doctor_id": doctor_id, "rand": Math.random() };
        ajaxPost("publicUtil_getDoctorInfoList", paramJson, showDoctorOk);
        return false;
    }


	
	function showDoctorOk(jsonInfo) {
	    var doctorList = strToJson(jsonInfo.data.proList); //3获取医生列表
	    var doctorListData = '';
	    //console.log(doctorList);
	    if (doctorList.length > 0) {
	        doctNums = doctorList.length;
	        for (var i = 0; i < doctNums; i++) {
	            if (doctorList[i].is_online == 1) {//是否在线  0否  1是
					doctorListData = '<div class="doctorMes" style="padding:20px 0;">';
					doctorListData += '<div class="img-wrapper "><img src="' + doctorList[i].doctor_img + '" /> <span class="weui-tabbar__label doc_state">在线</span></div>';
					doctorListData += '<div class="doctorMes" >';
					doctorListData += '<p style="font-size:14px;">' + doctorList[i].doctor_name + '　' + doctorList[i].department_name + '　' + doctorList[i].doctot_job_title + '</p>';
					doctorListData += '<p style="font-size:14px;">' + '　' + '从业年限' + doctorList[i].workAge + '年　年龄' + doctorList[i].doctorAge + '岁</p>';
					doctorListData += '<p style="font-size:12px;padding-top:10px;color:#888">' + doctorList[i].doctor_synopsis + '</p>';
					doctorListData += '<p style="font-size:12px;padding:10px">擅长：' + doctorList[i].doctor_begoodat + '</p>';
					doctorListData += '<hr/><p class="interval"> 请点击就诊类型</p>';
					doctorListData += '<div class="btn"><button class="inquiryBtn" style="background-color:#30cf9c;" num="1" id="' + doctorList[i].doctor_id + '" hid="' + doctorList[i].hospital_id + '" ><div><img src="../res/images/videoBtn.png"/></div><p>视频问诊<p></button><button class="inquiryBtn" style="background-color:#7bd5f3;" num="2" id="' + doctorList[i].doctor_id + '" ><div><img src="../res/images/photoBtn.png"/></div><p>图文问诊<p></button><button style="background-color:#e4aa05;" class="schedulingBtn" id="' + doctorList[i].doctor_id + '"><div><img src="../res/images/timeBtn.png"/></div><p>值班时间<p></button></div>';
	                doctorListData += '</div>';
	                doctorListData += '</div>';
	            }
	            else {
	                doctorListData = '<div class="doctorMes" style="padding:20px 0;">';
					doctorListData += '<div class="img-wrapper "><img src="' + doctorList[i].doctor_img + '" /> <span class="weui-tabbar__label doc_state">离线</span></div>';
					doctorListData += '<div class="doctorMes" >';
					doctorListData += '<p style="font-size:14px;">' + doctorList[i].doctor_name + '　' + doctorList[i].department_name + '　' + doctorList[i].doctot_job_title + '</p>';
					doctorListData += '<p style="font-size:14px;">' + '　' + '从业年限' + doctorList[i].workAge + '年　年龄' + doctorList[i].doctorAge + '岁</p>';
					doctorListData += '<p style="font-size:12px;padding-top:10px;color:#888">' + doctorList[i].doctor_synopsis + '</p>';
					doctorListData += '<p style="font-size:12px;padding:10px">擅长：' + doctorList[i].doctor_begoodat +'</p>';
					doctorListData += '<hr/><p class="interval"> 请点击就诊类型</p>';
					doctorListData += '<div class="btn"><button style="background-color:#30cf9c;" id="showIOSDialog1" ><div><img src="../res/images/videoBtn.png"/></div><p>视频问诊<p></button><button style="background-color:#7bd5f3;"  id="showIOSDialog2" ><div><img src="../res/images/photoBtn.png"/></div><p>图文问诊<p></button><button style="background-color:#e4aa05;" class="schedulingBtn" id="' + doctorList[i].doctor_id + '"><div><img src="../res/images/timeBtn.png"/></div><p>值班时间<p></button></div>';
	                doctorListData += '</div>';
	                doctorListData += '</div>';
	            }
	        }
	    }
	    $('#doctorList').html(doctorListData);
	    setTimeout(function () {
	        showDoctor();
	    }, 3000);
		$('#btnBack').on("click", function () {
		    history.go(-1);
		});
		
		
		$('#showIOSDialog1').on('click', function(){
		    // $iosDialog1.fadeIn(200);
			$.alert({
				title: '温馨提示',
				text: '当前医生离线，问诊消息回复可能不及时',
				onOK: '选择其他医生',function () {
					//点击确认
				}
			});
		});
		$('#showIOSDialog2').on('click', function(){
		    $.confirm({
		        title: '温馨提示',
		        text: '当前医生离线，问诊消息回复可能不及时',
		        onOK: function () {
		            //点击确认
		        },
		        onCancel: function () {
		        }
		    });
		});
	}
	
	//查看医生值班计划
	$(document).on("click", ".schedulingBtn", function () {
		log_type = $(this).attr('num');
		doctor_id = $(this).attr('id');
	    goPage('inquiry_doctor_sche.htm?doctor_id=' + doctor_id);
	});

    $(function () {
        doctor_id = getQst("doctor_id");
        showDoctor();

        //视频、图文问诊
        $(document).on("click", ".inquiryBtn", function () {
            log_type = $(this).attr('num');
            doctor_id = $(this).attr('id');
            if (!isLogin()) { //判断是否登录
                $.confirm("请先登录再操作", function() {
                	goPage('login.htm');
                }, function() {
                	//取消操作
                });
            } else {
				var strGoUrl;
                strGoUrl = 'inquiry_doctor_patient.htm?log_type=' + log_type + '&doctor_id=' + doctor_id + '&hospital_id=' + hospital_id+ "&rand=" + Math.random()+'&tvflag=1';
				goPage(strGoUrl);
            }
        });		

    });
</script>
<style>
	body {  background-color: #f1f3f4;}
	.header {  text-align: center;  z-index: 1;  width: 100%;  top: 0;  transition: 0.5s;}
	.doctor-avatar {width: 100px;height: 100px;	border: 1px solid #006400;	border-radius: 50%;	display: block;	margin: 0 auto 0.2933rem;	}
	.interval {	text-align: left;	width: 100%;	border-top: 10px solid #f1f3f4;	text-indent: 5px;	line-height: 30px;	font-weight: bold;}
	.doctorMes {display: flex;flex-direction: column;		justify-content: center;	align-items: center;	}
	.img-wrapper {	box-sizing: border-box;	/*float: left;*/	display: inline-block;	display: inline-flex;	align-items: center;	width: 6rem;	height: 6rem;	margin: 0.2rem 0.25rem;	position: relative;	overflow: hidden;	border-radius: 50%;	}
	.img-wrapper>img {border-radius: 50%;}
	img {	width: 100%;	height: 100%;	}
	.doc_state {	color: white;	background-color: rgba(0, 0, 0, 0.6);	position: absolute;	width: 6rem;	bottom: 0;	line-height: 1.5rem;}
	.fixed-top { /* border-bottom: 1px solid #e8e8e8; */ position: fixed; left: 0; top: 0; right: 0; z-index: 1; background: #F6F6F9; padding-bottom: 10px; }
	.weui-label-s { margin-top: 5px; padding: 5px;font-size: 16px; }
	.btn { display: flex; justify-content: space-around; padding: 30px 0;  }
	.btn>button { border: none; border-radius: 8px; width: 30%; display: flex; flex-direction: column; align-items: center; padding: 10px; outline: none; }
	.btn>button>div {width: 40%;}
	.btn>button p { color: white;  }
</style>
<body ontouchstart>
    <div class="fixed-top">
    <div class="weui-header weui-btn_primary"> 
        <div class="weui-header-left"><a id="btnBack" class="icon icon-109 f-white"></a></div>
        <div class="weui-header-title">专家资料</div>
        <div class="weui-header-right"></div>
    </div>
    </div>
    <div style="margin-top:40px;z-index:-1">
    <div class="weui-cells" style="margin: 0 10px;">
        <div id="doctorList"></div>
        <br />
    </div>
    </div>
</body>
</html>